<template>
  <div>
    <!-- 解决跨域 -->
    <button @click="getStudent">获取学生信息</button>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "App",
  methods: {
    getStudent() {
      // 请求跨域：cors
      // Access-Control-Allow-Origin
      // 跨域请求到了服务端，只是服务端没有返回数据
      axios.get("http://localhost:8080/wss/student").then(
        (response) => {
          console.log("请求成功", response.data);
        },
        (error) => {
          console.log("请求失败", error);
        }
      );
    },
  },
};
</script>
